package com.biz.primus.model.promotion.vo;

import com.biz.primus.base.vo.promotion.PromotionProductVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 特价商品Vo
 *
 * @author david-liu
 */
@Setter
@Getter
@ApiModel(value = "简单特价商品Vo")
public class SpecialOfferProductVo extends PromotionProductVo {
    private static final long serialVersionUID = -482680954663033498L;

    @ApiModelProperty(value = "特价(单位: 分)")
    private Integer specialOfferPrice;

    @ApiModelProperty(value = "限购数量(如果为空, 不限购)")
    private Integer purchaseQuantityLimit;

    @Override
    public String getProductName() {
        return StringUtils.isBlank(super.getProductName()) ? "" : super.getProductName();
    }

    @Override
    public Long getProductId() {
        return Objects.isNull(super.getProductId()) ? 0L : super.getProductId();
    }

    @Override
    public String getCategoryName() {
        return StringUtils.isBlank(super.getCategoryName()) ? "" : super.getCategoryName();
    }

    @Override
    public String getBrandName() {
        return StringUtils.isBlank(super.getBrandName()) ? "" : super.getBrandName();
    }

    @Override
    public String getProductCode() {
        return StringUtils.isBlank(super.getProductCode()) ? "" : super.getProductCode();
    }

    public Integer getSpecialOfferPrice() {
        return Objects.isNull(specialOfferPrice) ? 0 : specialOfferPrice;
    }

    public Integer getPurchaseQuantityLimit() {
        return Objects.isNull(purchaseQuantityLimit) ? 0 : purchaseQuantityLimit;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
